#ifndef __I2C2_TEST_H__
#define __I2C2_TEST_H__

#include "systick.h"
#include "gd32f4xx.h"

#define I2C2_SPEED					100000

//// PA8, PH7
#define I2C2_SCL_PORT_RCU			RCU_GPIOA
#define I2C2_SCL_PORT				GPIOA
#define I2C2_SCL_PIN				GPIO_PIN_8
#define I2C2_SCL_AF					GPIO_AF_4

//// PH8, PC9, PB4
#define I2C2_SDA_PORT_RCU			RCU_GPIOC
#define I2C2_SDA_PORT				GPIOC
#define I2C2_SDA_PIN				GPIO_PIN_9
#define I2C2_SDA_AF					GPIO_AF_4

void I2C2_init();

uint8_t I2C2_read(uint8_t addr, uint8_t reg, uint8_t* data, uint32_t len);

uint8_t I2C2_write(uint8_t addr, uint8_t reg, uint8_t* data, uint32_t len);

uint8_t I2C2_write2(uint8_t addr, uint8_t reg, uint8_t* data, uint32_t offset, uint32_t len);

void I2C2_deinit();



#endif